Repository navigation
Make VLAN reconciles create-only so existing NetBox VLANs are not rewritten - #270
Open
a-courteille wants to merge 1 commit into
Open
a-courteille wants to merge 1 commit into
a-courteille wants to merge 1 commit into
Conversation
…ritten Node and VM interface sync reconciled /api/ipam/vlans/ by VID with a hard-coded payload (name "VLAN <vid>", status active, Proxbox tags) and no patchable_fields. Every pre-existing VLAN whose VID appeared on an interface was therefore renamed, forced to active and re-tagged on the first sync. Pass NETBOX_VLAN_PATCHABLE_FIELDS (an empty set) to all eight VLAN reconciles: missing VLANs are still created as "VLAN <vid>", existing ones are only linked. A static test guards future VLAN call sites. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Node and VM interface sync reconciles
/api/ipam/vlans/by VID with a hard-coded payload (name: "VLAN <vid>",status: active, Proxbox tags) and nopatchable_fields. On a NetBox that already documents its VLANs, the first sync renames every VLAN whose VID appears on an interface toVLAN <vid>, forces it toactive, and replaces its tags.This PR makes VLAN reconciles create-only:
VLAN <vid>, exactly as before.Changes
proxmox_to_netbox/models.py: newNETBOX_VLAN_PATCHABLE_FIELDS: frozenset[str] = frozenset(), next toNetBoxVlanSyncState.patchable_fieldsto all eight VLAN reconciles:services/sync/network.py:_sync_legacy_node_vlan,_sync_node_interface_vlan,_resolve_vm_interface_vlanandbulk_reconcile_vlansservices/sync/vm_network.pyservices/sync/vm_network_processor.pyservices/sync/individual/interface_sync.pyroutes/virtualization/virtual_machines/sync_vm.pytests/test_vlan_reconcile_create_only.py:rest_reconcile_async: an existing VLAN (DEV_COMMON, statusreserved) is linked with nosave()and no POST, and a missing VID is created asVLAN <vid>;rest_reconcile_async/rest_bulk_reconcile_asynccall on/api/ipam/vlans/must passNETBOX_VLAN_PATCHABLE_FIELDS. Onmainit reports all 8 call sites; on this branch it reports none.docs/sync/workflows.mdanddocs/pt-BR/sync/workflows.md: a paragraph documenting the create-only VLAN behaviour.Not changed:
sdn.pylookup is read-only.Validation
Real sync, before vs after, on a copy of a production NetBox (NetBox 4.7.4, netbox-proxbox 0.0.29.post6, PVE 9.1.7, 3-node cluster, 140 pre-existing VLANs). The "after" run used the official
0.0.27.post4image with an equivalent create-only filter applied innetbox_rest.py:The sync job completed successfully.